import React from 'react'
import { Form, Input, Upload, Button, message } from 'antd'
import { UploadOutlined } from '@ant-design/icons'
import styles from './index.less'
export default () => {

    const handleUploadChange = (info: any): any => {
        let fileList = info.fileList;
        fileList = fileList.slice(-1);
        if (info.file.status === 'done') {
            message.success(`${info.file.name}文件上传成功`);
            fileList[0].url = fileList[0]['response']['data']['filePath'];
        }
        return fileList
    }
    return (
        <>
            <div className={styles.cardDiv}>
                <nav className={styles.navTitle}>联系人信息</nav>
                <div className={styles.cardContent}>
                    <Form.Item label="联系人姓名"  name="contact_username">
                        <Input style={{ width: "420px" }} />
                    </Form.Item>
                    <Form.Item label="联系人手机"  name="contact_mobile" help="填写有效的手机号，如有问题可通过该手机号联系到商家">
                        <Input style={{ width: "420px" }} />
                    </Form.Item>
                </div>
            </div>
            <div className={styles.cardDiv}>
                <nav className={styles.navTitle}>联系人身份证件</nav>
                <div className={styles.cardContent}>
                    <Form.Item label="联系人身份证号"  name="contact_id_card">
                        <Input style={{ width: "420px" }} />
                    </Form.Item>
                    <Form.Item label="申请人身份证正面"  name="id_card_front" valuePropName="fileList" getValueFromEvent={handleUploadChange}>
                        <Upload
                            action='http://127.0.0.1:8888/admin/tool/upload'
                            listType='picture'
                        >
                            <Button>
                                <UploadOutlined /> Upload
                        </Button>
                        </Upload>
                    </Form.Item>
                    <Form.Item label="申请人身份证反面"  name="id_card_back" valuePropName="fileList" getValueFromEvent={handleUploadChange}>
                        <Upload
                            action='http://127.0.0.1:8888/admin/tool/upload'
                            listType='picture'
                        >
                            <Button>
                                <UploadOutlined /> Upload
                            </Button>
                        </Upload>
                    </Form.Item>
                </div>
            </div>
        </>
    )
}